package com.cloudfunx.common.jdbc;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author linjiayu
 */
@Getter
@Setter
public class TableInfo {

    private String table;

    private List<ColumnInfo> list = new ArrayList<>();

    public TableInfo(String table) {
        this.table = table;
        list.add(ColumnInfo.builder().name("create_time").type("datetime  DEFAULT CURRENT_TIMESTAMP ").build());
        list.add(ColumnInfo.builder().name("update_time").type("datetime DEFAULT NULL ").build());
        list.add(ColumnInfo.builder().name("delete_flag").type("int(2) DEFAULT '0' COMMENT '0' ").build());
        list.add(ColumnInfo.builder().name("member_id").type("bigint(20)").build());
        list.add(ColumnInfo.builder().name("value").type("varchar(200)").build());
        list.add(ColumnInfo.builder().name("class_name").type("varchar(200)").build());
        list.add(ColumnInfo.builder().name("method_name").type("varchar(200)").build());
        list.add(ColumnInfo.builder().name("param_info").type("varchar(500)").build());
    }

    // public TableInfo(String table, List<ColumnInfo> list) {
    //     this.table = table;
    //     this.list = list;
    // }

    @Getter
    @Setter
    @Builder
    public static class ColumnInfo {
        private String name;
        private String type;
        private String comment;
    }
}
